<!DOCTYPE html>
<html class="" lang="en">
	<head prefix="og: http://ogp.me/ns#">
		{% include 'twig/common/header/include.twig' %}

		<script src="/gitlab/assets/webpack/filtered_search.bundle.js"></script>

		<script src="/dev/lib/moment.js"></script>
		<script src="/dev/lib/url_param.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/js/admin/issue_ui.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/js/issue/form.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/js/issue/adv_query.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/js/issue/detail.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/js/issue/main.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
        <script src="/dev/js/issue/filtered_search.js?v={{_version}}" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/lib/handlebars-v4.0.10.js" type="text/javascript" charset="utf-8"></script>
		<link href="/dev/lib/video-js/video-js.min.css" rel="stylesheet">
		<script src="/dev/lib/video-js/video.min.js"></script>

		<script>
			window.description_templates = {{ description_templates|json_encode()|raw }};
            window.project_uploads_path = "/issue/main/upload?project_id=  {{ project_id }}";
            window.preview_markdown_path = "/issue/main/preview_markdown";
		</script>

		<script src="/dev/lib/bootstrap-select/js/bootstrap-select.js" type="text/javascript" charset="utf-8"></script>
		<link href="/dev/lib/bootstrap-select/css/bootstrap-select.css" rel="stylesheet">

		<script src="/dev/lib/bootstrap-paginator/src/bootstrap-paginator.js?v={{_version}}" type="text/javascript"></script>
		<script type="text/javascript" src="/dev/lib/qtip/dist/jquery.qtip.min.js"></script>
		<link rel="stylesheet" type="text/css" href="/dev/lib/qtip/dist/jquery.qtip.min.css"/>

		<script src="/dev/lib/simplemde/dist/simplemde.min.js"></script>
		<link rel="stylesheet" href="/dev/lib/simplemde/dist/simplemde.min.css">

		<!-- Fine Uploader jQuery JS file-->
		<link href="/dev/lib/fine-uploader/fine-uploader.css" rel="stylesheet">
		<link href="/dev/lib/fine-uploader/fine-uploader-gallery.css" rel="stylesheet">
		<script src="/dev/lib/e-smart-zoom-jquery.min.js"></script>
		<script src="/dev/lib/fine-uploader/jquery.fine-uploader.js?v={{_version}}"></script>

		<link href="/dev/lib/laydate/theme/default/laydate.css" rel="stylesheet">
		<script src="/dev/lib/laydate/laydate.js"></script>

		<script src="/dev/lib/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
		<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
		<script src="/dev/lib/jquery-file-upload/js/jquery.iframe-transport.js"></script>
		<script src="/dev/lib/jquery-file-upload/js/jquery.fileupload.js"></script>

		<script src="/dev/lib/mousetrap/mousetrap.min.js"></script>
		<link rel="stylesheet" href="/dev/lib/editor.md/css/editormd.css"/>

		<script src="/dev/lib/editor.md/lib/marked.min.js"></script>
		<script src="/dev/lib/editor.md/lib/prettify.min.js"></script>
		<script src="/dev/lib/editor.md/lib/flowchart.min.js"></script>
		<script src="/dev/lib/editor.md/lib/jquery.flowchart.min.js"></script>
		<script src="/dev/lib/editor.md/editormd.js"></script>

		<script src="/dev/lib/sweetalert2/sweetalert-dev.js"></script>
		<link rel="stylesheet" href="/dev/lib/sweetalert2/sweetalert-dev.css"/>

		<link rel="stylesheet" href="/dev/css/issue/list.css?v={{_version}}"/>
        <style type="text/css">
            .active_underline a{
                text-decoration: underline;
                font-weight: 600;
                font-size: 14px;
                line-height: 28px;
            }
            .active_underline a span{
                color: #1f78d1;
            }
            .filter_active_underline a span{
                color: #fc9403;
            }
            .nav-links.sub-nav li a {
                margin: 0;
                padding: 4px 2px 4px;
            }
        </style>
	</head>

	<body class="" data-group="" data-page="projects:issues:index" data-project="xphp">
		<div class=""></div>
		{% include 'twig/common/body/script.twig' %}

		<section class="has-sidebar page-layout max-sidebar">
			{% include 'twig/common/body/page-left.twig' %}

			<div class="page-layout page-content-body">
				{% include 'twig/common/body/header-content.twig' %}

				<script>
					var findFileURL = "";
				</script>
				<div class="page-with-sidebar">
					{% include 'twig/project/common-page-nav-project.twig' %}
					{% include 'twig/issue/common-filter-nav-links-sub-nav.twig' %}

					<div class="content-wrapper page-with-layout-nav page-with-sub-nav">
						<div class="alert-wrapper">

							<div class="flash-container flash-container-page"></div>
						</div>
						<div class=" ">
							<div class="content issue-list-page" id="content-body">
								<div class="container-fluid padding-0">

									<div class="issues-filters">
										<div class="filtered-search-block issues-details-filters row-content-block second-block" v-pre="false">
											<form id="filter-form" class="filter-form js-filter-form" action="#" accept-charset="UTF-8" method="get" >
												<input name="utf8" type="hidden" value="&#x2713;"/>
												<input
												name="page" id="filter_page" type="hidden" value="1">
												<!--<div class="check-all-holder">
																								                                            <input type="checkbox" name="check_all_issues" id="check_all_issues"
																								                                                   class="check_all_issues left"/>
																								                                        </div>-->
												<div class="issues-other-filters filtered-search-wrapper">
													<div class="filtered-search-box" title="按回车键提交查询或点击搜索按钮">
														<div class="dropdown filtered-search-history-dropdown-wrapper">
															<button class="dropdown-menu-toggle filtered-search-history-dropdown-toggle-button" type="button" data-toggle="dropdown">
																<span class="dropdown-toggle-text">
																	<i class="fa fa-history"></i>
																</span>
																<i class="fa fa-chevron-down"></i>
															</button>
															<div class="dropdown-menu dropdown-select filtered-search-history-dropdown">
																<div class="dropdown-title">
																	<span>历史搜索</span>
																	<button class="dropdown-title-button dropdown-menu-close" aria-label="Close" type="button">
																		<i class="fa fa-times dropdown-menu-close-icon"></i>
																	</button>
																</div>
																<div class="dropdown-content filtered-search-history-dropdown-content">
																	<ul class="js-filtered-search-history-dropdown"></ul>
																</div>
																<div class="dropdown-loading">
																	<i class="fa fa-spinner fa-spin"></i>
																</div>
															</div>
														</div>
														{% verbatim %}
															<div class="filtered-search-box-input-container">
																<div class="scroll-container">
																	<ul class="tokens-container list-unstyled">
																		<li class="input-token">
																			<input class="form-control filtered-search" data-base-endpoint="/ismond/xphp" data-project-id="31" data-username-params="[]" id="filtered-search-issues" placeholder="搜索或过滤结果..." autocomplete="off">
																		</li>
																	</ul>
																	<i class="fa fa-filter"></i>
																	<button class="clear-search hidden" type="button">
																		<i class="fa fa-times"></i>
																	</button>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu hint-dropdown" id="js-dropdown-hint">
																	<ul data-dropdown>
																		<li class="filter-dropdown-item" data-action="submit">
																			<button class="btn btn-link">
																				<i class="fa fa-search"></i>
																				<span>提示:按"回车键"进行查询</span>
																			</button>
																		</li>
																	</ul>
																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<i class="fa {{icon}}"></i>
																				<span class="js-filter-hint">{{hint}}</span>
																				<span class="js-filter-tag dropdown-light-content">{{tag}}</span>
																			</button>
																		</li>
																	</ul>
																</div>

																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="报告人" data-icon="pencil" data-tag="@author" id="js-dropdown-author">
																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link dropdown-user">
																				<img alt="{{name}}&#39;s avatar" class="avatar" data-src="{{avatar_url}}" width="30">
																				<div class="dropdown-user-details">
																					<span>{{name}}</span>
																					<span class="dropdown-light-content js-data-value">@{{username}}</span>
																				</div>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="经办人" data-icon="user" data-tag="@assignee" id="js-dropdown-assignee">
																	<ul data-dropdown>
																		<li class="filter-dropdown-item" data-value="none">
																			<button class="btn btn-link">
																				--
																			</button>
																		</li>
																		<li class="divider"></li>
																	</ul>
																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link dropdown-user">
																				<img alt="{{name}}&#39;s avatar" class="avatar" data-src="{{avatar_url}}" width="30">
																				<div class="dropdown-user-details">
																					<span>{{name}}</span>
																					<span class="dropdown-light-content js-data-value">@{{username}}</span>
																				</div>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="迭代" data-icon="rocket" data-tag="sprint" data-type="input" id="js-dropdown-sprint">
																	<ul data-dropdown>
																		<li class="filter-dropdown-item" data-value="none">
																			<button class="btn btn-link">
																				--
																			</button>
																		</li>
																		<li class="divider"></li>
																	</ul>
																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span class="label-title js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="模块" data-icon="square" data-tag="module" data-type="input" id="js-dropdown-module">
																	<ul data-dropdown>
																		<li class="filter-dropdown-item" data-value="none">
																			<button class="btn btn-link">
																				--
																			</button>
																		</li>
																		<li class="divider"></li>
																	</ul>
																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span class="label-title js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="状态" data-icon="info" data-tag="status" data-type="input" id="js-dropdown-status">

																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span class="label label-{{color}} js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="解决结果" data-icon="info" data-tag="resolve" data-type="input" id="js-dropdown-resolve">

																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span style="color:{{color}}" class="label-title js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="优先级" data-icon="info" data-tag="priority" data-type="input" id="js-dropdown-priority">

																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span style="color:{{status_color}}" class="label-title js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
																<div class="filtered-search-input-dropdown-menu dropdown-menu" data-hint="类型" data-icon="info" data-tag="issue_type" data-type="input" id="js-dropdown-issue_type">

																	<ul class="filter-dropdown" data-dropdown data-dynamic>
																		<li class="filter-dropdown-item">
																			<button class="btn btn-link">
																				<span  class="label-title js-data-value">{{name}}</span>
																			</button>
																		</li>
																	</ul>
																</div>
															</div>
														{% endverbatim %}
                                            </div>
                                            <button class="dropdown-toggle" id="btn-go_search" type="submit"
                                                    title="请求数据" style="margin-left: -1px;">
                                                <i class="fa fa-search "></i>
                                                搜 索
                                            </button>
                                            <button class="dropdown-toggle btn-adv-search" id="save_filter-btn" type="button"
                                                    title="保存搜索的条件"  >
                                                <i class="fa fa-save "></i>
                                                保 存
                                            </button>
                                            <button class="dropdown-toggle btn-adv-search" id="btn-adv_search" type="button"
                                                    title="高级查询" data-target="#modal-adv_query" data-toggle="modal">
                                                <i class="fa fa-binoculars "></i>
                                                高 级
                                            </button>
                                            <div class="filter-dropdown-container" style="margin-left: -1px">
                                                <div class="dropdown inline   issue-sort-dropdown">
                                                    <div class="btn-group" role="group">
                                                        <div class="btn-group" role="group">
                                                            <button id="btn-sort_field"
                                                                    title="排序字段"
                                                                    style="height: 38.5px; width: 110px;"
                                                                    data-sort_field="{{ sort_field }}"
                                                                    class="btn btn-default dropdown-menu-toggle"
                                                                    data-display="static"
                                                                    data-toggle="dropdown"
                                                                    type="button">
                                                                {{ avl_sort_fields[sort_field] }}
                                                                <i aria-hidden="true" data-hidden="true"
                                                                   class="fa fa-chevron-down"></i>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right dropdown-menu-selectable dropdown-menu-sort">
                                                                <li>
                                                                    {% for avl_sort_field,field_name in avl_sort_fields %}
                                                                        <a class="sort_select {{ sort_field == avl_sort_field ? 'is-active' : '' }}"
                                                                           data-field="{{ avl_sort_field }}" href="#">
                                                                            {{ field_name }}
                                                                        </a>
                                                                    {% endfor %}
                                                                </li>
                                                            </ul>
                                                        </div>
                                                        <a id="btn_sort_by" type="button" data-sortby="{{ sort_by }}"
                                                           class="btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort"
                                                           title="{{ sort_by == 'desc' ? '降序' : '升序' }}"
                                                           style="height:38.5px" href="#">
                                                            {% if (sort_by == '' or sort_by == 'desc') %}
                                                                <svg class="s16">
                                                                    <use style="stroke: rgba(245, 245, 245, 0.85);"
                                                                         xlink:href="/dev/img/svg/icons-sort.svg#sort-highest"></use>
                                                                </svg>
                                                            {% endif %}
                                                            {% if (sort_by == 'asc') %}
                                                                <svg class="s16">
                                                                    <use style="stroke: rgba(245, 245, 245, 0.85);"
                                                                         xlink:href="/dev/img/svg/icons-sort.svg#sort-lowest"></use>
                                                                </svg>
                                                            {% endif %}
                                                        </a>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="filter-dropdown-container">
                                                <div class="dropdown inline prepend-left-10" style="height: 38.5px">

                                                    <div class="list-settings">
                                                        <button id="change_view" class="dropdown-toggle " type="button"
                                                                title="切换视图" data-toggle="dropdown" aria-haspopup="true"
                                                                aria-expanded="false" style="height: 38.5px">
                                                            <i id="change_view_icon"
                                                               class="fa {% if (issue_view == 'list') %}fa-table{% endif %} {% if (issue_view == 'responsive') %}fa-outdent{% endif %}"
                                                            ></i>
                                                            <span id="change_view_span">
																		{% if (issue_view == 'list') %}
                                                                            表格视图
                                                                        {% endif %}
                                                                {% if (issue_view == 'responsive') %}
                                                                    响应式视图
                                                                {% endif %}
																	</span>
                                                            <i aria-hidden="true" data-hidden="true"
                                                               class="fa fa-chevron-down"></i>
                                                        </button>
                                                        <!-- aria-haspopup="true" aria-expanded="false"-->
                                                        <ul class="dropdown-menu action-list"
                                                            aria-labelledby="dropdownMenuButton" id="view_choice">
                                                            <li data-issue_view="list"
                                                                class="normal  {% if (issue_view == 'list') %} active {% endif %}"
                                                                data-stoppropagation="true">
                                                                <i class="fa fa-table"></i>
                                                                表格视图
                                                            </li>
                                                            {% if (issue_view != 'responsive') %}
                                                                <li data-issue_view="detail"
                                                                    class="float-part   {% if (issue_view == 'detail') %} active  {% endif %}"
                                                                    data-stoppropagation="true">
                                                                    <i class="fa fa-outdent"></i>
                                                                    左右视图
                                                                </li>
                                                            {% endif %}
                                                            <li data-issue_view="responsive"
                                                                class="float {% if (issue_view == 'responsive') %} active {% endif %}">
                                                                <i class="fa fa-list"></i>
                                                                响应式视图
                                                            </li>
                                                        </ul>
                                                    </div>
                                                    <div class="list-settings">
                                                        <button id="list_opt" class="dropdown-toggle" type="button"
                                                                title="操作" data-toggle="dropdown" aria-haspopup="true"
                                                                style="height: 38.5px" aria-expanded="false">
                                                            更 多
                                                            <i class="fa fa-chevron-down"></i>
                                                        </button>
                                                        <!-- aria-haspopup="true" aria-expanded="false"-->
                                                        <ul class="dropdown-menu settings-list"
                                                            aria-labelledby="dropdownMenuButton" for-id="list_opt"
                                                            id="opt_choice">
                                                            <li class="normal" data-stoppropagation="true">
                                                                <a href="/user/filters">
                                                                    <i class="fa fa-filter"></i>
                                                                    管理自定义过滤器</a>
                                                            </li>
                                                            <li class="normal" data-stoppropagation="true">
                                                                <a data-target="#modal-setting_columns"
                                                                   data-toggle="modal" id="a-setting_columns"
                                                                   href="#modal-setting_columns">
                                                                    <i class="fa fa-check-square-o"></i>
                                                                    设置显示列</a>
                                                            </li>
                                                            {% if (this.isAdmin or projectPermArr['IMPORT_EXCEL'] is defined) %}

                                                                <li class="float-part" data-stoppropagation="true">
                                                                    <a data-target="#modal-import_excel"
                                                                       data-toggle="modal" id="a-import-excel"
                                                                       href="#modal-import_excel">
                                                                        <i class="fa fa-arrow-up"></i>
                                                                        导入Excel数据
                                                                    </a>
                                                                </li>
                                                            {% endif %}

                                                            {% if (this.isAdmin or projectPermArr['EXPORT_EXCEL'] is defined) %}

                                                                <li class="float-part" data-stoppropagation="true">
                                                                    <a data-target="#modal-export_excel"
                                                                       data-toggle="modal" id="a-export-excel"
                                                                       href="#modal-export_excel">
                                                                        <i class="fa fa-download"></i>
                                                                        导出Excel数据
                                                                    </a>
                                                                </li>
                                                            {% endif %}

                                                        </ul>
                                                    </div>

                                                    {% if (projectPermArr['CREATE_ISSUES'] is defined) %}

                                                        <a class="btn btn-new js-key-create"
                                                           title="快捷键 C 可呼出创建事项表单"
                                                           data-target="#modal-create-issue"
                                                           data-toggle="modal"
                                                           id="btn-create-issue"
                                                           style="height:36px;margin-bottom: 3px"
                                                           href="#modal-create-issue">
                                                            <i class="fa fa-plus fa-fw"></i>
                                                            创 建
                                                        </a>
                                                    {% endif %}

                                                </div>

                                            </div>
                                        </div>
                                    </form>
                                </div>
                                        <div id="adv_query_display_container" class="row-content-block second-block adv-query-display hide"  style="padding: 8px;">

                                            <div class="selector-set" >
                                                <strong>高级查询 </strong><i class="fa fa-angle-right"></i>
                                                <span  id="adv_query_diplay" class="adv-query-diplay-item">

                                                </span>
                                                <a class="clear-adv-query" onclick="window.location = '{{project_root_url}}'" href="#">清空筛选</a>
                                            </div>
                                            <style type="text/css">
                                                .selector-set .ss-item {
                                                    position: relative;
                                                    display: inline-block;
                                                    line-height: 22px;
                                                    border: 1px solid #e8e8e8;
                                                    color: #666;
                                                    font-size: 12px;
                                                    margin: 0 5px 0 4px;
                                                    padding: 2px 6px 2px 6px;
                                                    cursor: pointer;
                                                }

                                                .adv-query-display .selector-set {
                                                    display: flex;
                                                    flex-direction: row;
                                                    align-items: center;
                                                }

                                                .adv-query-display .selector-set > i {
                                                    margin: 0 6px;
                                                }

                                                .selector-set .ss-item strong,
                                                .selector-set .ss-item b{
                                                    margin-right: 2px;
                                                }

                                                .clear-adv-query {
                                                    line-height: 26px;
                                                    padding: 0 8px;
                                                    border: solid 1px #e8e8e8;
                                                    background: #f9f9f9;
                                                    display: block;
                                                    margin-left: 8px;
                                                    color: #6b6b6b;
                                                }

                                                .selector-set .ss-item:hover {
                                                    text-decoration: none;
                                                    color: #333;
                                                }

                                                .adv-query-display {
                                                    background: #fff;
                                                    line-height: 28px;
                                                }
                                                .ss-item a {
                                                    color: #666;
                                                    text-decoration: none;
                                                }
                                                /*.selector-set .ss-item i {
                                                    display: block;
                                                    position: absolute;
                                                    width: 25px;
                                                    height: 22px;
                                                    right: 0;
                                                    top: 0;
                                                    background: url(/dev/img/search.ele.png) no-repeat 7px -140px;
                                                }*/
                                                .selector-set .ss-item em {
                                                    color: #e4393c;
                                                }

                                            </style>
                                        </div>
                                <div
                                        class="small-tips hide">
                                    <!-- todo:当用户第一次进来，点击input的时候，然后setTimeout消失 -->
                                    <img src="/dev/img/tips_top.png" alt="">
                                    这是一些提示
                                </div>
                            </div>

                            <script>
                                new UsersSelect();
                                new LabelsSelect();
                                new MilestoneSelect();
                                new IssueStatusSelect();
                                new SubscriptionSelect();
                                var filteredSearchManager = null;
                                $(document).off('page:restore').on('page:restore', function (event) {
                                    if (gl.FilteredSearchManager) {
                                        window.filteredSearchManager = new gl.FilteredSearchManager();
                                    }
                                    Issuable.init();
                                    new gl.IssuableBulkActions({prefixId: 'issue_'});
                                });
                            </script>

                            <div class="issues-holder">

                                <div class="table-holder">
                                    <table class="table  tree-table" id="tree-slider" style="display:none;">
                                        <thead>

                                        <tr>

                                            <th class="js-pipeline-info pipeline-info">
                                                {% if ( 'issue_num' in  display_fields) %}编 号
                                                {% endif %}
                                            </th>

                                            {% if ('issue_type'in display_fields) %}
                                                <th class="js-pipeline-stages pipeline-info">
                                                    <a class="sort_link" data-field="issue_type"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        类型
                                                        {% if sort_field == 'issue_type' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('priority'in display_fields) %}
                                                <th class="js-pipeline-stages pipeline-info">
                                                    <a class="sort_link" data-field="priority"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        优先级
                                                        {% if sort_field == 'priority' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if (is_all_issues or 'project_id'in display_fields) %}

                                                <th class="js-pipeline-info pipeline-info">项 目</th>
                                            {% endif %}

                                            {% if ('module'in display_fields) %}
                                                <th class="js-pipeline-info pipeline-info">
                                                    <a class="sort_link" data-field="module"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        模 块
                                                        {% if sort_field == 'module' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('sprint'in display_fields) %}
                                                <th class="js-pipeline-info pipeline-info">
                                                    <a class="sort_link" data-field="sprint"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        迭
                                                        代
                                                        {% if sort_field == 'sprint' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('summary'in display_fields) %}
                                                <th class="js-pipeline-commit pipeline-commit">主 题</th>
                                            {% endif %}

                                            {% if ('weight'in display_fields) %}
                                                <th class="js-pipeline-info pipeline-info">
                                                    <a class="sort_link" data-field="weight"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        权
                                                        重
                                                        {% if sort_field == 'weight' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('assignee'in display_fields) %}
                                                <th class="js-pipeline-stages pipeline-info">
                                                    <a class="sort_link" data-field="assignee"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        经办人
                                                        {% if sort_field == 'assignee' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('reporter'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    报告人
                                                </th>
                                            {% endif %}

                                            {% if ('assistants'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    协助人
                                                </th>
                                            {% endif %}

                                            {% if ('status'in display_fields) %}
                                                <th class="js-pipeline-stages pipeline-info">
                                                    <a class="sort_link" data-field="status"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        状
                                                        态
                                                        {% if sort_field == 'status' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('resolve'in display_fields) %}
                                                <th class="js-pipeline-stages pipeline-info">
                                                    <a class="sort_link" data-field="resolve"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        解决结果
                                                        {% if sort_field == 'resolve' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('environment'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    运行环境
                                                </th>
                                            {% endif %}

                                            {% if ('plan_date'in display_fields) %}
                                                <th class="js-pipeline-date pipeline-date">
                                                    <a title="排序将按 '截止日期' 排列" class="sort_link" data-field="due_date"
                                                       data-sortby="{{ sort_by == 'desc' ? 'asc' : 'desc' }}" href="#">
                                                        计划时间
                                                        {% if sort_field == 'due_date' %}
                                                            <i class="fa fa-sort-{{ sort_by }}"></i>
                                                        {% endif %}
                                                    </a>
                                                </th>
                                            {% endif %}

                                            {% if ('resolve_date'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    实际解决日期
                                                </th>
                                            {% endif %}

                                            {% if ('modifier'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    最后修改人
                                                </th>
                                            {% endif %}

                                            {% if ('master_id'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    是否父任务
                                                </th>
                                            {% endif %}

                                            {% if ('created'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    创建时间
                                                </th>
                                            {% endif %}

                                            {% if ('updated'in display_fields) %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    最后修改时间
                                                </th>
                                            {% endif %}


                                            {% for item in displayCustomFieldArr %}
                                                <th class="jjs-pipeline-stages pipeline-info">
                                                    {{item.title}}
                                                </th>
                                            {% endfor %}

                                            <th class="js-pipeline-actions pipeline-actions">操 作

                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody id="list_render_id"></tbody>
                                    </table>
                                </div>
                                <div class="table-holder">
                                    <div id="detail_render_id" style="display:none;"></div>
                                </div>

                                <ul class="issues-content-list" id="ul_issues" style="display:none;"></ul>
                                <div class="row-content-block second-block" v-pre="false">
                                    <form class="filter-form js-filter-form" action="#" accept-charset="UTF-8"
                                          method="get">
                                        <div class="issuable-actions" id="issue-actions">
                                            <input type="checkbox" name="btn-check_all_issues" id="btn-check_all_issues"
                                                   class="left">
                                            全 选
                                            <span style="margin-left: 1em">
														选中项：
													</span>
                                            <div class="btn-group" role="group" aria-label="...">
                                                {% if (projectPermArr['DELETE_ISSUES'] is defined) %}

                                                    <button id="btn-batchDelete" type="button" class="btn btn-default">
                                                        <i class="fa fa-remove"></i>
                                                        删 除
                                                    </button>
                                                {% endif %}
                                                <div class="btn-group" role="group">
                                                    <button type="button" class="btn btn-default dropdown-toggle"
                                                            data-toggle="dropdown" aria-haspopup="true"
                                                            aria-expanded="false">
                                                        解决结果
                                                        <i class="fa fa-caret-down"></i>
                                                    </button>
                                                    <ul class="dropdown-menu">
                                                        {% for item in issue_resolve %}
                                                            <li>
                                                                <a class="btn_batch_update" data-field="resolve"
                                                                   data-id="{{ item['id'] }}" href="#"
                                                                   style="color:{{ item['color'] }}">{{ item['name'] }}</a>
                                                            </li>
                                                        {% endfor %}

                                                    </ul>
                                                </div>

                                                <div class="btn-group" role="group">
                                                    <button type="button" class="btn btn-default dropdown-toggle"
                                                            data-toggle="dropdown" aria-haspopup="true"
                                                            aria-expanded="false">
                                                        模 块
                                                        <i class="fa fa-caret-down"></i>
                                                    </button>
                                                    <ul class="dropdown-menu">
                                                        {% for key,item in project_modules %}
                                                            <li>
                                                                <a class="btn_batch_update" data-field="module"
                                                                   data-id="{{ key }}" href="#">{{ item['name'] }}</a>
                                                            </li>
                                                        {% endfor %}

                                                    </ul>
                                                </div>

                                                <div class="btn-group" role="group">
                                                    <button type="button" class="btn btn-default dropdown-toggle"
                                                            data-toggle="dropdown" aria-haspopup="true"
                                                            aria-expanded="false">
                                                        迭 代
                                                        <i class="fa fa-caret-down"></i>
                                                    </button>
                                                    <ul class="dropdown-menu">
                                                        {% for item in sprints %}
                                                            <li>
                                                                <a class="btn_batch_update" data-field="sprint"
                                                                   data-id="{{ item['id'] }}"
                                                                   href="#">{{ item['name'] }}</a>
                                                            </li>
                                                        {% endfor %}

                                                    </ul>
                                                </div>
                                            </div>

                                            <span style="margin-left: 1em">
														总数:<span id="issue_count"></span>
														每页显示:<span id="page_size"></span>
													</span>
                                        </div>
                                    </form>
                                </div>

                                <div class="gl-pagination" id="ampagination-bootstrap"></div>

                            </div>


                            {% include 'twig/issue/detail-right-list.twig' %}

                        </div>
                    </div>
                </div>
            </div>

            <!-- <div class="maskLayer hide"></div> -->
            <!--背景遮罩-->

            <div id="tips_panel" class="modal">
                <div class="modal-dialog" style="width:100%;">
                    <div class="card" style="width: 1200px;margin:0 auto;">
                        <div class="block-bg text-center">
                            <img src="/dev/img/smile.png" alt="">
                            <h4 class="text-center">header</h4>
                            <a class="btn close-detail-tips">Thanks & Return</a>
                        </div>
                        <img class="tips_arrow_bottom" src="/dev/img/tips_bottom.png" alt="">
                        <div class="card-body text-center">
                            <p class="card-text">Some make up the bulk of the card's content.</p>
                        </div>
                    </div>
                </div>
            </div>
            <!--第二阶段实施-->

            {% include 'twig/issue/list_modal.twig' %}
            {% include 'twig/issue/form.twig' %}
            {% include 'twig/issue/list_handbars_tpl.twig' %}


            <script src="/dev/js/handlebars.helper.js?v={{ _version }}"></script>
            <script src="/dev/js/handlebars.responsive.helper.js?v={{ _version }}" type="text/javascript" charset="utf-8"></script>
            <!--script src="/dev/js/websocket.js?v={{ _version }}"></script-->
            <script src="/dev/lib/sortable/Sortable.js"></script>
            <script src="/dev/lib/sortable/Sortable.js"></script>
            {% include 'twig/issue/list_adv_query.twig' %}

            <script type="text/javascript">
                var _issueConfig = {
                    "priority": {{ priority|json_encode()|raw }},
                    "issue_types": {{ issue_types|json_encode()|raw }},
                    "issue_status": {{ issue_status|json_encode()|raw }},
                    "issue_resolve": {{ issue_resolve|json_encode()|raw }},
                    "issue_module": {{ project_modules|json_encode()|raw }},
                    "issue_version": {{ project_versions|json_encode()|raw }},
                    "issue_labels": {{ project_labels|json_encode()|raw }},
                    "users": {{ users|json_encode()|raw }},
                    "project_users": {{ project_users|json_encode()|raw }},
                    "projects": {{ projects|json_encode()|raw }},
                    "sprint": {{ sprints|json_encode()|raw }},
                    "project_root_url": "{{ project_root_url }}"
                };

                var _project_issue_types = {{ project_issue_types|json_encode()|raw }};

                var _simplemde = {};

                var _fineUploaderFile = {};
                var _fineImportExcelUploader = null;
                var _issue_id = null;
                var _cur_project_id = '{{ project_id }}';
                var _active_sprint_id = '{{ active_sprint['id'] }}';
                var _cur_uid = null;
                var _editor_md = null;
                var _description_templates = {{ description_templates|json_encode()|raw }};
                var _is_create_sprint_issue = false;

                var $IssueMain = null;
                var $IssueAdvQuery = null;
                var $IssueDetail = null;
                var query_str = '{{ query_str }}';
                var urls = parseURL(window.location.href);
                var $sort_field = '{{ sort_field }}';
                var $sort_by = '{{ sort_by }}';
                var is_all_issues = '{{ is_all_issues }}';

                var display_fields = {{ display_fields|json_encode()|raw }};
                var uiDisplayFields = {{ uiDisplayFields|json_encode()|raw }};
                var advFields = {{ advFields|json_encode()|raw }};

                var is_save_filter = '0';

                var qtipApi = null;

                var _fineUploader = null;
                var _detailFineUploader = null;

                var subtack = [];
                var isFloatPart = false;
                var advQueryType = "text";
                var advQuerySource = "";
                var advQueryTitle = "请选择";
                var adv_details = [];
                var sort_adv_temp_item = {};

                var adv_filter_json = {{ adv_filter_json|raw }}
                var is_adv_filter = '{{ is_adv_filter }}';

                new UsersSelect();

                var issue_view = '{{ issue_view }}';
                var list_render_id = 'list_render_id';
                var list_tpl_id = 'list_tpl';
                if (issue_view === 'responsive') {
                    list_render_id = 'ul_issues';
                    list_tpl_id = 'responsive_tpl';
                    $("#ul_issues").show();
                }
                if (issue_view === 'detail') {
                    list_render_id = 'detail_render_id';
                    list_tpl_id = 'list_tpl_detail';
                    $("#detail_render_id").show();
                }
                if (issue_view === 'list') {
                    $("#tree-slider").show();
                }

                $(function () {
                    var options = {
                        query_str: window.query_str,
                        query_param_obj: urls.searchObject,
                        list_render_id: list_render_id, // list_render_id detail_render_id
                        list_tpl_id: list_tpl_id, // list_tpl list_tpl_detail
                        filter_form_id: "filter_form",
                        filter_url: "/issue/main/filter?project={{ project_id }}",
                        get_url: "/issue/main/get",
                        update_url: "/issue/main/update",
                        add_url: "/issue/main/add",
                        delete_url: "/issue/main/delete",
                        pagination_id: "pagination"
                    };

                    function getdata(res) {
                        for (var i in res.issues) {
                            if (res.issues[i]['master_id'] && res.issues[i]['master_id'] > 0) {
                                subtack.push(res.issues[i]);
                            }
                        }
                    }

                    window.$IssueMain = new IssueMain(options);
                    window.$FilteredSearch = new FilteredSearch(urls.searchObject, _issueConfig, _cur_project_id);
                    if(is_adv_filter==='0' || is_empty(adv_filter_json)){
                        window.$IssueMain.fetchIssueMains(getdata);
                    }else{
                        adv_details = adv_filter_json;
                        var tempData = JSON.parse(JSON.stringify(adv_details));
                        var temp = tempData.map(function (n) {
                            return {
                                logic: n.logic,
                                start_braces: n.start_braces,
                                field: n.field,
                                opt: n.opt,
                                value: n.value,
                                end_braces: n.end_braces
                            }
                        });
                        var adv_data = tempData.map(function (n) {
                            return n
                        });

                        var queryData = JSON.stringify(temp);
                        IssueMain.prototype.fetchIssuesByAdvQueryIssue(queryData,null, adv_data);
                    }

                    $('#btn-add').bind('click', function () {
                        IssueMain.prototype.add();
                    });

                    $("#btn-create-issue").bind("click", function () {
                        $('#master_issue_id').val('');
                        $('#create_master_div').hide();
                        if (window._cur_project_id !== '') {
                            var issue_types = [];
                            _cur_form_project_id = _cur_project_id;
                            for (key in _project_issue_types) {
                                issue_types.push(_project_issue_types[key]);
                            }
                            IssueMain.prototype.initCreateIssueType(_project_issue_types, true);
                        } else {
                            _cur_form_project_id = "";
                        }
                    });


                    $('#btn-update').bind('click', function () {
                        IssueMain.prototype.update();
                    });

                    $('#btn-close').bind('click', function () {
                        IssueMain.prototype.detailClose($(this).data('issue_id'));
                    });

                    $('#btn-delete').bind('click', function () {
                        IssueMain.prototype.detailDelete($(this).data('issue_id'));
                    });

                    $('#btn-batchDelete').bind('click', function () {
                        IssueMain.prototype.batchDelete();
                    });
                    $('#btn-check_all_issues').bind('click', function () {
                        IssueMain.prototype.checkedAll();
                    });

                    $('#btn-setting_columns').bind('click', function () {
                        IssueMain.prototype.saveUserIssueDisplayFields();
                    });


                    $('.btn_batch_update').bind('click', function () {
                        var field = $(this).data('field');
                        var value = $(this).data('id');
                        IssueMain.prototype.batchUpdate(field, value);
                    });

                    $('.sort_select').bind('click', function () {

                        var searchObj = {};
                        for (var i in urls.searchObject) {
                            let key = decodeURIComponent(i);
                            searchObj[key] = decodeURIComponent(urls.searchObject[i]);
                        }
                        var field = $(this).data('field');
                        $('#btn-sort_field').data('sort_field', field)
                        var sortby = $('#btn_sort_by').data('sortby');
                        searchObj['sort_field'] = field;
                        searchObj['sort_by'] = sortby;
                        console.log(searchObj);

                        url = root_url + urls.pathname.substr(1) + '?' + parseParam(searchObj);
                        console.log(url);
                        window.location.href = url;
                    });

                    $('#btn_sort_by').bind('click', function () {
                        var searchObj = {};
                        for (var i in urls.searchObject) {
                            var key = decodeURIComponent(i);
                            var value = decodeURIComponent(urls.searchObject[i]);
                            searchObj[key] = value;
                        }
                        var field = $('#btn-sort_field').data('sort_field');
                        var sortby = '';
                        if ($(this).data('sortby') === 'desc' || is_empty($(this).data('sortby'))) {
                            sortby = 'asc';
                        } else {
                            sortby = 'desc';
                        }
                        $(this).data('sortby', sortby);

                        searchObj['sort_field'] = field;
                        searchObj['sort_by'] = sortby;
                        console.log(searchObj);

                        url = root_url + urls.pathname.substr(1) + '?' + parseParam(searchObj);
                        console.log(url);
                        window.location.href = url;
                    });


                    $('.sort_link').bind('click', function () {

                        var searchObj = {};
                        for (var i in urls.searchObject) {
                            var key = decodeURIComponent(i);
                            var value = decodeURIComponent(urls.searchObject[i]);
                            searchObj[key] = value;
                        }

                        var field = $(this).data('field');
                        var sortby = $(this).data('sortby');
                        searchObj['sort_field'] = field;
                        searchObj['sort_by'] = sortby;
                        console.log(searchObj);

                        url = root_url + urls.pathname.substr(1) + '?' + parseParam(searchObj);
                        console.log(url);
                        window.location.href = url;
                    });


                    $('#view_choice li').bind('click', function () {

                        $('#view_choice .active').removeClass('active');
                        $(this).addClass('active');
                        var selectIssueView = $(this).data('issue_view');
                                    // alert(selectIssueView);
                        if (selectIssueView === 'detail') {
                            $('#change_view_span').html('左右视图');
                            $('#change_view_icon').removeClass('fa-table').addClass('fa-outdent');
                            var firstTabelTr = $('#list_render_id tr:first-child');
                            var detailRender = $('#detail_render_id');
                            var dataId = firstTabelTr.data('id') || $('#detail_render_id div:first-child').data('id');
                            var dataSummary = firstTabelTr.data('summary') || $('#detail_render_id div:first-child').data('summary') || "";
                            isFloatPart = true;

                            if (detailRender.length) {
                                showFloatDetail(dataId, dataSummary);
                            } else {
                                showFloatDetail(dataId, dataSummary);
                            }
                            firstTabelTr.addClass('active');
                            detailRender.children(":first").addClass('issue-box-active');
                        } else {
                            $('#change_view_icon').removeClass('fa-outdent').addClass('fa-table');
                            $('#change_view_span').html('表格视图')
                            isFloatPart = false;
                            IssueMain.prototype.updateUserIssueView(selectIssueView);
                        }

                    });

                    // 点击tips提示
                    $('#showMoreTips').click(function () {
                        $('#tips_panel').modal();
                        $('.camper-helper').addClass('hide');
                    });

                    // 关闭背景颜色
                    $('#tips_panel').on('shown.bs.modal', function () {
                        $('.modal-backdrop.in').css('opacity', '0.2');
                    });

                    // 关闭tips提示框
                    $('#closeTips').click(function () {
                        $('.camper-helper').addClass('hide');
                    });

                    // 关闭tips的弹出框
                    $('.close-detail-tips').click(function () {
                        $('.camper-helper').removeClass('hide');
                        $('#tips_panel').modal('hide');
                    });


                    // 添加bottom的textare的focus事件
                    $('.bottom-part textarea').on('focus', function () {
                        $('.textarea-tips').addClass('hide');
                    });

                    $('.bottom-part textarea').on('blur', function () {
                        $('.textarea-tips').addClass('hide');
                        if (this.value == '') {
                            $('.textarea-tips').removeClass('hide');
                        }
                    // $('.textarea-tips').addClass('hide');
                    });

                    let el_list_render_id = $('#list_render_id');
                    var _isTable = el_list_render_id.length;

                    $(document).on('click', '.detail-pager .previous:not(".disabled")', function () {
                        IssueMain.prototype.prevIssueItem();
                    });

                    $(document).on('click', '.detail-pager .next:not(".disabled")', function () {
                        IssueMain.prototype.nextIssueItem();
                    });

                    // 点击事件，以及左侧菜单的内容
                    el_list_render_id.on('click', function (e) {
                        $('#list_render_id tr.active').removeClass('active');
                        if ($(e.target).attr('href') && $(e.target).parent().hasClass('show-tooltip')) {
                            $(e.target).parent().parent().addClass('active');
                        } else if ($(e.target).parent().next().hasClass('pop_subtack hide')) {
                            //$(e.target).parent().next().removeClass('hide');
                            $(e.target).parent().addClass('active');
                        } else if ($(e.target).parent().next().hasClass('pop_subtack')) {
                            //$(e.target).parent().next().addClass('hide');
                            $(e.target).parent().removeClass('active');
                        }
                    });

                    el_list_render_id.on("click", ".tree-item", function() {
                        if (isFloatPart) {
                            var dataId = $(this).data("id");
                            var dataSummary = $(this).data("summary") || "";
                            $(this).addClass("active").siblings(".tree-item").removeClass("active");
                            showFloatDetail(dataId, dataSummary);
                            
                            return false;
                        }else{
                            let have_children = 0;
                            var issue_id = $(this).data('id');
                            $('#tr_subtask_' + issue_id).toggleClass('hide');
                            have_children = $(this).data('have_children');
                            if( have_children>0){
                                IssueMain.prototype.fetchChildren(issue_id, 'ul_subtask_' + issue_id);
                            }
                        }
                    });

                    $('#detail_render_id').on('click', '.issue-box', function (e) {
                        var dataId = $(this).data('id');
                        var dataSummary = $(this).data("summary") || "";
                        if (!$(e.target).attr('type') && !$(e.target).hasClass('commit-id') && !$(e.target).hasClass('label') && !$(e.target).hasClass('prepend-left-5') && !$(e.target).parent().hasClass('resolve-select')) {
                            $(this).addClass('issue-box-active').siblings('.issue-box').removeClass('issue-box-active');
                            if (isFloatPart) {
                                showFloatDetail(dataId, dataSummary);
                                return false;
                            }
                        }
                    });


                    // 右侧详情上下事项切换

                    // 获取详情页信息
                    function getRightPartData(dataId) {
                        $('.maskLayer').removeClass('hide'); // 可以不要，但是由于跳转的时候速度太慢，所以防止用户乱点击
                        _issue_id = dataId;                        

                        IssueMain.prototype.initIssueItem();

                        $IssueDetail = new IssueDetail({});
                        $IssueDetail.fetchIssue(dataId, true);
                    }

                    // 显示右侧浮动窗
                    function showFloatDetail(dataId, dataSummary) {
                        getFineUploader(dataId, dataSummary);
                        getRightPartData(dataId);
                        $('.float-right-side').show();
                    }

                    /*详情页的ajax*/
                    $('#save_filter-btn').qtip({
                        content: {
                            text: $('#save_filter_tpl').html(),
                            title: "新增过滤器",
                            button: "关闭"
                        },
                        show: 'click',
                        hide: 'click',
                        style: {
                            classes: "qtip-bootstrap",
                            width: "500px"
                        },
                        position: {
                            my: 'top left', // Position my top left...
                            at: 'bottom center', // at the bottom right of...
                            target: $('.filtered-search')
                        },
                        events: {
                            show: function (event, api) {
                                var t = setTimeout("$('#save_filter_text').focus();", 200)
                            }
                        }
                    });
                    window.qtipApi = $('#save_filter-btn').qtip('api');

                    $('#btn-save_adv_filter').qtip({
                        content: {
                            text: $('#save_adv_filter_tpl').html(),
                            title: "新增过滤器",
                            button: "关闭"
                        },
                        position: {
                            target: 'event', 
                            at: 'top left',
                            my: "right center",
                            adjust: {x: -5}
                        },
                        show: 'click',
                        hide: 'click',
                        style: {
                            classes: "qtip-bootstrap",
                            width: "500px"
                        },
                        events: {
                            show: function (event, api) {
                                var t = setTimeout("$('#save_adv_filter_text').focus();", 200)
                            }
                        }
                    });
                    window.qtipApi = $('#btn-save_adv_filter').qtip('api');
                    /*
                    $(document).click(function(event){
                            var _con = $('.qtip');  // 设置目标区域
                            var _event = $("#btn-save_adv_filter");
                            if(!_con.is(event.target) && _con.has(event.target).length === 0 && !_event.is(event.target) && _event.has(event.target).length === 0){ 
                                window.qtipApi.hide()
                                $('#btn-save_adv_filter').qtip('api').toggle(false);
                            }
                    });
                    */
                    var el_custom_filter_more = $('#custom-filter-more');
                    el_custom_filter_more.qtip({
                        content: {
                            text: $('#custom-filter-tpl').html(),
                            title: "更多过滤器",
                            button: "关闭"
                        },
                        show: 'click',
                        hide: 'click',
                        style: {
                            classes: "qtip-bootstrap",
                            width: "500px"
                        },
                        position: {
                            my: 'top right', // Position my top left...
                            at: 'bottom center', // at the bottom right of...
                        }
                    });
                    window.qtipApi = el_custom_filter_more.qtip('api');

                    // 右边悬浮层按钮事件
                    $('#btn-edit').bind('click', function () {
                        window.$IssueMain.fetchEditUiConfig(_issue_id, 'update');
                    });

                    $('#btn-copy').bind('click', function () {
                        window.$IssueMain.fetchEditUiConfig(_issue_id, 'copy');
                    });

                    keyMaster.addKeys([
                        {
                            key: "e",
                            'item-element': '.tree-item',
                            'trigger-element': '.issue_edit_href',
                            trigger: 'click'
                        },
                        {
                            key: "d",
                            'item-element': '.tree-item',
                            'trigger-element': '.issue_delete_href',
                            trigger: 'click'
                        }
                    ])

                    $("#modal-create-issue").on('show.bs.modal', function (e) {
                        keyMaster.addKeys(
                            [
                                {
                                    key: [
                                        'command+enter', 'ctrl+enter'
                                    ],
                                    'trigger-element': '#modal-create-issue .btn-save',
                                    trigger: 'click'
                                }, {
                                    key: 'esc',
                                    'trigger-element': '#modal-create-issue .close',
                                    trigger: 'click'
                                }
                            ]
                        )
                    })

                    $("#modal-edit-issue").on('show.bs.modal', function (e) {
                        keyMaster.addKeys([
                            {
                                key: [
                                    'command+enter', 'ctrl+enter'
                                ],
                                'trigger-element': '#modal-edit-issue .btn-save',
                                trigger: 'click'
                            }
                        ])
                    })

                    $("#modal-export_excel").on('show.bs.modal', function (e) {
                        keyMaster.addKeys([
                            {
                                key: [
                                    'command+enter', 'ctrl+enter'
                                ],
                                'trigger-element': '.js-key-modal-enter1',
                                trigger: 'click'
                            }, {
                                key: 'esc',
                                'trigger-element': '.js-key-modal-close1',
                                trigger: 'click'
                            }
                        ])
                    });

                    // 提交导出 excel 表单
                    $("#btn-export_excel").click(function () {
                        // 当前查询参数字符串
                        // alert(_issue_cur_page);
                        var curUrlParams = window.location.search;
                        curUrlParams = curUrlParams.substr(1);
                        var exportRangeType = $("input[name='radio-export_range']:checked").val();

                        if (exportRangeType == 'project_all') {
                            curUrlParams = '';
                        }

                        var formParams = $("#form-export_excel").serialize();
                        var action = "/project/export/issue?" + curUrlParams + "&" + formParams + "&cur_page=" + _issue_cur_page + '&project_id=' + window.cur_project_id;
                        // alert(action);
                        $("#form-export_excel").attr("action", action);
                        $("#form-export_excel").submit();
                        $('#modal-export_excel').modal('hide');
                        notify_success('请稍后,等待文件自动下载');
                    });

                    $('#import_excel_file').fileupload({
                        url: '/issue/main/importExcel?project_id=' + window.cur_project_id,
                        singleFileUploads: true,
                        done: function (e, uploadObj) {
                            var resp = uploadObj.result;
                            console.log(resp)
                            if (resp.ret == '200') {
                                notify_success(resp.msg);
                            } else {
                                notify_error(resp.msg, resp.data);
                            }
                            $('#import_excel_result').html(resp.data);
                        },
                        fail: function (e, uploadObj) {
                            var resp = uploadObj.result;
                            // alert(resp.msg);
                            console.log(resp)
                            notify_error(resp.msg, resp.data);
                            $('#import_excel_result').html(resp.data);
                        },
                        progressall: function (e, data) { // console.log(data)
                            var progress = parseInt(data.loaded / data.total * 100, 10);
                            $('#import_excel_progress .progress-bar').css('width', progress + '%');
                        }
                    }).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');

                    // 获取上传插件
                    function getFineUploader(issue_id, sum = "121") {
                        _fineUploader = null;
                        $("#issue_right_attachments_uploder").html("");
                        _fineUploader = new qq.FineUploader({
                            element: document.getElementById('issue_right_attachments_uploder'),
                            template: 'qq-template-gallery',
                            multiple: true,
                            request: {
                                endpoint: '/issue/main/upload?project_id=' + _cur_project_id + '&issue_id=' + issue_id + '&summary=' + sum + '&_csrftoken=' + encodeURIComponent(document.getElementById('csrf_token').value)
                            },
                            deleteFile: {
                                enabled: true,
                                forceConfirm: true,
                                endpoint: "/issue/main/upload_delete/" + _cur_project_id
                            },
                            validation: {
                                allowedExtensions: [
                                    'mp3',
                                    'aac',
                                    'wma',
                                    'avi',
                                    'rm',
                                    'rmvb',
                                    'flv',
                                    'mpg',
                                    'mov',
                                    'mkv',
                                    'mp4',
                                    'jpeg',
                                    'jpg',
                                    'gif',
                                    'png',
                                    '7z',
                                    'zip',
                                    'rar',
                                    'bmp',
                                    'csv',
                                    'doc',
                                    'docx',
                                    'xls',
                                    'xlsx',
                                    'ppt',
                                    'pdf',
                                    'xlt',
                                    'xltx',
                                    'txt'
                                ]
                            }
                        });                      
                    }
                });
                //startWS();关闭websocket

                var _curFineAttachmentUploader = null;
                var _curIssueId = null;
                var _curTmpIssueId = null;
                var _curQrToken = null;
                var mobileUploadInterval = null;
            </script>
</body>
</html>
